home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.n / library.n < prev    next >
Text File  |  1995-07-25  |  16KB  |  263 lines

  1.  
  2.  
  3.  
  4.      lllliiiibbbbrrrraaaarrrryyyy((((nnnn))))                   TTTTccccllll (((( ))))                   lllliiiibbbbrrrraaaarrrryyyy((((nnnn))))
  5.  
  6.  
  7.  
  8.      _________________________________________________________________
  9.  
  10.      NNNNAAAAMMMMEEEE
  11.           library - standard library of Tcl procedures
  12.  
  13.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  14.           aaaauuuuttttoooo____eeeexxxxeeeeccccooookkkk _c_m_d
  15.           aaaauuuuttttoooo____llllooooaaaadddd _c_m_d
  16.           aaaauuuuttttoooo____mmmmkkkkiiiinnnnddddeeeexxxx _d_i_r _p_a_t_t_e_r_n _p_a_t_t_e_r_n ...
  17.           aaaauuuuttttoooo____rrrreeeesssseeeetttt
  18.           ppppaaaarrrrrrrraaaayyyy _a_r_r_a_y_N_a_m_e
  19.           uuuunnnnkkkknnnnoooowwwwnnnn _c_m_d ?_a_r_g _a_r_g ...?
  20.      _________________________________________________________________
  21.  
  22.  
  23.      IIIINNNNTTTTRRRROOOODDDDUUUUCCCCTTTTIIIIOOOONNNN
  24.           Tcl includes a library of Tcl procedures for commonly-needed
  25.           functions.   The  procedures  defined in the Tcl library are
  26.           generic  ones   suitable   for   use   by   many   different
  27.           applications.   The  location of the Tcl library is returned
  28.           by the  iiiinnnnffffoooo  lllliiiibbbbrrrraaaarrrryyyy  command.   In  addition  to  the  Tcl
  29.           library, each application will normally have its own library
  30.           of support procedures as well;  the location of this library
  31.           is  normally  given  by the value of the $$$$_a_p_p____lllliiiibbbbrrrraaaarrrryyyy global
  32.           variable, where _a_p_p is the name  of  the  application.   For
  33.           example,  the  location  of  the  Tk  library is kept in the
  34.           variable $$$$ttttkkkk____lllliiiibbbbrrrraaaarrrryyyy.
  35.  
  36.           To access the procedures in the Tcl library, an  application
  37.           should  source the file iiiinnnniiiitttt....ttttccccllll in the library, for example
  38.           with the Tcl command
  39.  
  40.                ssssoooouuuurrrrcccceeee [[[[iiiinnnnffffoooo lllliiiibbbbrrrraaaarrrryyyy]]]]////iiiinnnniiiitttt....ttttccccllll
  41.           This will define the uuuunnnnkkkknnnnoooowwwwnnnn procedure and arrange  for  the
  42.           other  procedures to be loaded on-demand using the auto-load
  43.           mechanism defined below.
  44.  
  45.  
  46.      CCCCOOOOMMMMMMMMAAAANNNNDDDD PPPPRRRROOOOCCCCEEEEDDDDUUUURRRREEEESSSS
  47.           The following procedures are provided in the Tcl library:
  48.  
  49.           aaaauuuuttttoooo____eeeexxxxeeeeccccooookkkk _c_m_d
  50.                Determines whether there is an executable file  by  the
  51.                name _c_m_d.  This command examines the directories in the
  52.                current search path  (given  by  the  PATH  enviornment
  53.                variable)  to  see if there is an executable file named
  54.                _c_m_d in any of those directories.  If so, it returns  1;
  55.                if  not  it returns 0.  AAAAuuuuttttoooo____eeeexxxxeeeecccc remembers information
  56.                about previous searches in an array  named  aaaauuuuttttoooo____eeeexxxxeeeeccccssss;
  57.                this  avoids  the  path  search in future calls for the
  58.                same _c_m_d.  The command aaaauuuuttttoooo____rrrreeeesssseeeetttt may be used to  force
  59.                aaaauuuuttttoooo____eeeexxxxeeeeccccooookkkk to forget its cached information.
  60.  
  61.  
  62.      Page 1                                          (printed 7/17/95)
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.      lllliiiibbbbrrrraaaarrrryyyy((((nnnn))))                   TTTTccccllll (((( ))))                   lllliiiibbbbrrrraaaarrrryyyy((((nnnn))))
  70.  
  71.  
  72.  
  73.           aaaauuuuttttoooo____llllooooaaaadddd _c_m_d
  74.                This command attempts to load the definition for a  Tcl
  75.                command  named  _c_m_d.   To do this, it searches an _a_u_t_o-
  76.                _l_o_a_d _p_a_t_h, which is a list of one or more  directories.
  77.                The  auto-load  path  is  given  by the global variable
  78.                $$$$aaaauuuuttttoooo____ppppaaaatttthhhh if it exists.  If  there  is  no  $$$$aaaauuuuttttoooo____ppppaaaatttthhhh
  79.                variable,  then  the TCLLIBPATH environment variable is
  80.                used, if  it  exists.   Otherwise  the  auto-load  path
  81.                consists  of  just  the  Tcl library directory.  Within
  82.                each directory in the auto-load path there  must  be  a
  83.                file  ttttccccllllIIIInnnnddddeeeexxxx  that  describes  one  or  more commands  |
  84.                defined in that directory and a script to  evaluate  to  |
  85.                load each of the commands.  The ttttccccllllIIIInnnnddddeeeexxxx file should be  |
  86.                generated with the aaaauuuuttttoooo____mmmmkkkkiiiinnnnddddeeeexxxx  command.   If  _c_m_d  is  |
  87.                found  in an index file, then the appropriate script is  |
  88.                evaluated to create the command.  The aaaauuuuttttoooo____llllooooaaaadddd command
  89.                returns 1 if _c_m_d was successfully created.  The command
  90.                returns 0 if there was no index entry for _c_m_d or if the
  91.                script  didn't  actually define _c_m_d (e.g. because index
  92.                information is out of date).  If an error occurs  while
  93.                processing  the  script,  then  that error is returned.
  94.                AAAAuuuuttttoooo____llllooooaaaadddd only reads the  index  information  once  and
  95.                saves  it  in  the  array  aaaauuuuttttoooo____iiiinnnnddddeeeexxxx;  future calls to
  96.                aaaauuuuttttoooo____llllooooaaaadddd check for _c_m_d in the array  rather  than  re-
  97.                reading  the index files.  The cached index information
  98.                may be deleted with the command aaaauuuuttttoooo____rrrreeeesssseeeetttt.  This  will
  99.                force  the  next  aaaauuuuttttoooo____llllooooaaaadddd command to reload the index
  100.                database from disk.
  101.  
  102.           aaaauuuuttttoooo____mmmmkkkkiiiinnnnddddeeeexxxx _d_i_r _p_a_t_t_e_r_n _p_a_t_t_e_r_n ...
  103.                Generates an index suitable for use by aaaauuuuttttoooo____llllooooaaaadddd.   The  |
  104.                command  searches  _d_i_r  for all files whose names match  |
  105.                any of the _p_a_t_t_e_r_n arguments (matching is done with the
  106.                gggglllloooobbbb  command),  generates  an  index  of  all  the Tcl
  107.                command procedures defined in all the  matching  files,
  108.                and  stores  the  index  information  in  a  file named
  109.                ttttccccllllIIIInnnnddddeeeexxxx in _d_i_r.  For example, the command
  110.  
  111.                     aaaauuuuttttoooo____mmmmkkkkiiiinnnnddddeeeexxxx ffffoooooooo ****....ttttccccllll
  112.                will read all the ....ttttccccllll files in  subdirectory  ffffoooooooo  and
  113.                generate a new index file ffffoooooooo////ttttccccllllIIIInnnnddddeeeexxxx.
  114.  
  115.                AAAAuuuuttttoooo____mmmmkkkkiiiinnnnddddeeeexxxx parses the Tcl  scripts  in  a  relatively
  116.                unsophisticated  way:   if  any  line contains the word
  117.                pppprrrroooocccc as its first characters then it is assumed to be a
  118.                procedure  definition  and the next word of the line is
  119.                taken as the procedure's name.   Procedure  definitions
  120.                that  don't  appear  in this way (e.g. they have spaces
  121.                before the pppprrrroooocccc) will not be indexed.
  122.  
  123.  
  124.  
  125.      Page 2                                          (printed 7/17/95)
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.      lllliiiibbbbrrrraaaarrrryyyy((((nnnn))))                   TTTTccccllll (((( ))))                   lllliiiibbbbrrrraaaarrrryyyy((((nnnn))))
  133.  
  134.  
  135.  
  136.           aaaauuuuttttoooo____rrrreeeesssseeeetttt
  137.                Destroys all the information cached by aaaauuuuttttoooo____eeeexxxxeeeeccccooookkkk  and
  138.                aaaauuuuttttoooo____llllooooaaaadddd.   This information will be re-read from disk
  139.                the next time it is needed.   AAAAuuuuttttoooo____rrrreeeesssseeeetttt  also  deletes
  140.                any  procedures  listed in the auto-load index, so that
  141.                fresh copies of them will be loaded the next time  that
  142.                they're used.
  143.  
  144.           ppppaaaarrrrrrrraaaayyyy _a_r_r_a_y_N_a_m_e
  145.                Prints on standard output the names and values  of  all
  146.                the elements in the array _a_r_r_a_y_N_a_m_e.  AAAArrrrrrrraaaayyyyNNNNaaaammmmeeee must be
  147.                an array accessible to the caller of ppppaaaarrrrrrrraaaayyyy.  It may be
  148.                either local or global.
  149.  
  150.           uuuunnnnkkkknnnnoooowwwwnnnn _c_m_d ?_a_r_g _a_r_g ...?
  151.                This procedure is  invoked  automatically  by  the  Tcl
  152.                interpreter  whenever  the  name  of  a command doesn't
  153.                exist.  The uuuunnnnkkkknnnnoooowwwwnnnn procedure receives as its arguments
  154.                the name and arguments of the missing command.  UUUUnnnnkkkknnnnoooowwwwnnnn  |
  155.                first calls aaaauuuuttttoooo____llllooooaaaadddd to load  the  command.   If  this
  156.                succeeds,  then  it  executes the original command with
  157.                its original arguments.  If the  auto-load  fails  then
  158.                uuuunnnnkkkknnnnoooowwwwnnnn  calls  aaaauuuuttttoooo____eeeexxxxeeeeccccooookkkk  to  see  if  there  is  an
  159.                executable file by the name _c_m_d.  If so, it invokes the
  160.                Tcl   eeeexxxxeeeecccc  command  with  _c_m_d  and  all  the  _a_r_g_s  as
  161.                arguments.  If  _c_m_d  can't  be  auto-executed,  uuuunnnnkkkknnnnoooowwwwnnnn
  162.                checks  to  see if the command was invoked at top-level
  163.                and outside of any script.  If so, then  uuuunnnnkkkknnnnoooowwwwnnnn  takes
  164.                takes  two additional steps.  First, it sees if _c_m_d has
  165.                one of  the  following  three  forms:  !!!!!!!!,  !!!!_e_v_e_n_t,  or
  166.                ^^^^_o_l_d^^^^_n_e_w?^^^^?.   If  so, then uuuunnnnkkkknnnnoooowwwwnnnn carries out history
  167.                substitution in the same way that ccccsssshhhh would  for  these
  168.                constructs.  Second, and last, uuuunnnnkkkknnnnoooowwwwnnnn checks to see if
  169.                _c_m_d is  a  unique  abbreviation  for  an  existing  Tcl
  170.                command.   If  so,  it  expands  the  command  name and
  171.                executes the command with the original  arguments.   If
  172.                none  of the above efforts has been able to execute the
  173.                command, uuuunnnnkkkknnnnoooowwwwnnnn generates an  error  return.   If  the
  174.                global  variable aaaauuuuttttoooo____nnnnoooollllooooaaaadddd is defined, then the auto-
  175.                load  step  is  skipped.   If   the   global   variable
  176.                aaaauuuuttttoooo____nnnnooooeeeexxxxeeeecccc  is  defined  then  the  auto-exec  step is
  177.                skipped.  Under normal circumstances the  return  value
  178.                from  uuuunnnnkkkknnnnoooowwwwnnnn is the return value from the command that
  179.                was eventually executed.
  180.  
  181.  
  182.      VVVVAAAARRRRIIIIAAAABBBBLLLLEEEESSSS
  183.           The following global variables are defined or  used  by  the
  184.           procedures in the Tcl library:
  185.  
  186.           aaaauuuuttttoooo____eeeexxxxeeeeccccssss
  187.                Used by aaaauuuuttttoooo____eeeexxxxeeeeccccooookkkk to record information about whether
  188.  
  189.  
  190.  
  191.      Page 3                                          (printed 7/17/95)
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.      lllliiiibbbbrrrraaaarrrryyyy((((nnnn))))                   TTTTccccllll (((( ))))                   lllliiiibbbbrrrraaaarrrryyyy((((nnnn))))
  199.  
  200.  
  201.  
  202.                particular commands exist as executable files.
  203.  
  204.           aaaauuuuttttoooo____iiiinnnnddddeeeexxxx
  205.                Used by aaaauuuuttttoooo____llllooooaaaadddd to save the  index  information  read
  206.                from disk.
  207.  
  208.           aaaauuuuttttoooo____nnnnooooeeeexxxxeeeecccc
  209.                If set to any value, then uuuunnnnkkkknnnnoooowwwwnnnn will not  attempt  to
  210.                auto-exec any commands.
  211.  
  212.           aaaauuuuttttoooo____nnnnoooollllooooaaaadddd
  213.                If set to any value, then uuuunnnnkkkknnnnoooowwwwnnnn will not  attempt  to
  214.                auto-load any commands.
  215.  
  216.           aaaauuuuttttoooo____ppppaaaatttthhhh
  217.                If set, then it must contain a valid  Tcl  list  giving
  218.                directories to search during auto-load operations.
  219.  
  220.           eeeennnnvvvv((((TTTTCCCCLLLL____LLLLIIIIBBBBRRRRAAAARRRRYYYY))))
  221.                If set, then it specifies the location of the directory
  222.                containing  library scripts (the value of this variable
  223.                will be returned by the command iiiinnnnffffoooo lllliiiibbbbrrrraaaarrrryyyy).  If this
  224.                variable isn't set then a default value is used.
  225.  
  226.           eeeennnnvvvv((((TTTTCCCCLLLLLLLLIIIIBBBBPPPPAAAATTTTHHHH))))
  227.                If set, then it must contain a valid  Tcl  list  giving
  228.                directories  to  search  during  auto-load  operations.
  229.                This variable is only used if aaaauuuuttttoooo____ppppaaaatttthhhh is not defined.
  230.  
  231.           uuuunnnnkkkknnnnoooowwwwnnnn____aaaaccccttttiiiivvvveeee
  232.                This variable is set by uuuunnnnkkkknnnnoooowwwwnnnn to indicate that it  is
  233.                active.   It  is  used  to  detect errors where uuuunnnnkkkknnnnoooowwwwnnnn
  234.                recurses on itself infinitely.  The variable  is  unset
  235.                before uuuunnnnkkkknnnnoooowwwwnnnn returns.
  236.  
  237.  
  238.      KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  239.           auto-exec, auto-load, library, unknown
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.      Page 4                                          (printed 7/17/95)
  258.  
  259.  
  260.  
  261.